<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.List" %>
<%@ page import="admin.board.boardModel" %>
<jsp:useBean id="dao" scope="page" class="admin.board.boardDao" />
<%

	//기본 세트 값 시작
	String searchGubn = request.getParameter("searchGubn") == null ? "" : request.getParameter("searchGubn");
	String searchValue = request.getParameter("searchValue") == null ? "" : request.getParameter("searchValue");
	int     giSelectPage  	= Integer.parseInt(request.getParameter("txtSelectPage") == null ? "0" :request.getParameter("txtSelectPage"));			//현재 선택된 페이지 저장
	int     giSelectBlock 	= Integer.parseInt(request.getParameter("txtSelectBlock") == null ? "0" :request.getParameter("txtSelectBlock"));			//현재 선택된 블락페이지 저장
	String searchBoard = request.getParameter("searchBoard") == null ? "" : request.getParameter("searchBoard");
	//기본 세트 값 끝

	String data_id = request.getParameter("data_id") == null ? "" : request.getParameter("data_id");
	boardModel model = dao.getView(data_id);
	boardModel prvModel = dao.getPrev(data_id, searchBoard,  searchGubn,  searchValue);
	boardModel nextModel = dao.getNext(data_id, searchBoard,  searchGubn,  searchValue);


%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>원룸 - 게시판 관리</title>
<script type="text/javascript" src="/admin/js/default.js"></script>
<link href="/admin/css/default.css" rel="stylesheet" type="text/css" />
<!--[if lte IE 6]><link rel="stylesheet" href="/admin/css/forie6.css" type="text/css" /><![endif]-->
<script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
<!--
$(document).ready(function(){
	
	$('#btList').click(function() {
		document.getElementById("frm").action = "list.jsp";
		document.getElementById("frm").submit();
	});
	$('#btDelete').click(function() {
		document.getElementById("gubun").value = "D";
		document.getElementById("frm").action = "dbx.jsp";
		document.getElementById("frm").submit();
	});
	
});
//-->
</script>
</head>
<body>
<div id="bodywrap">
	<div class="all-wrap">
		<%@ include file="/admin/common/top.jsp" %>
		<div id="right-wrap">
			<%@ include file="/admin/common/navi.jsp" %>
			<!--Contents Start-->
			<div id="content">
				<form action="update.jsp" name="frm" id="frm" method="post">
				<input type="hidden" name="searchGubn" id="searchGubn"  value="<%=searchGubn %>"/>
				<input type="hidden" name="searchValue" id="searchValue"  value="<%=searchValue %>"/>
				<input type="hidden" name="txtSelectPage" id="txtSelectPage"  value="<%=giSelectPage %>"/>
				<input type="hidden" name="txtSelectBlock" id="txtSelectBlock" value="<%=giSelectBlock %>"/> 
				<input type="hidden" name="data_id" id="data_id" value="<%=data_id %>"/>
				<input type="hidden" name="searchBoard" value="<%=searchBoard %>"/>
				<input type="hidden" name="gubun" id="gubun" value=""/>
				<!-- 삭제 관련된 변수 시작 -->
				<input type="hidden" name="org_file" 	value="<%=model.getOrg_file()%>"/>
				<input type="hidden" name="att_file" 	value="<%=model.getAtt_file()%>"/>
				<!-- 삭제 관련되 변수 끝 -->
				<!-- 타이틀 및 전체 갯수 검색 시작 -->
				<div class="path">
					<span>home</span> &gt;  게시판 관리
				</div>
				<h4>게시판 관리</h4>
				<p class="sub-text">게시판 관리 하실 수 있습니다.</p>
				<!-- 타이틀 및 전체 갯수 검색  끝-->
				<!-- 실제적인 리스트 시작 -->
				<table class="view-normal" cellpadding="0" cellspacing="0" summary="게시판 관리" >
					<caption>게시판 관리</caption>
					    <col width="100px;" />  
					    <col/>  
				    <tbody>
						<tr>
							<th scope="row" >구분</th>
							<td>
							<%if(model.getBoard_kind().equals("us")){out.print("contact us");}
							else if(model.getBoard_kind().equals("qna")){out.print("Q&A");}
							else if(model.getBoard_kind().equals("faq")){out.print("faq");}
							else if(model.getBoard_kind().equals("news")){out.print("news");}
							%>
							</td>
				        </tr>
				        <tr>
							<th scope="row" >제목</th>
							<td>
								<%=model.getTitle() %>
							</td>
				        </tr>
				        <% if(model.getBoard_kind().equals("us")){ %>
				        <tr>
							<th scope="row" >메일 주소</th>
							<td>
								<%=model.getEmail1()==null?"":model.getEmail1()  %>@<%=model.getEmail2()==null?"":model.getEmail2() %>
							</td>
				        </tr>
				        <tr>
							<th scope="row" >연락처</th>
							<td>
								<%=model.getTel1()==null?"":model.getTel1() %>-<%=model.getTel2()==null?"":model.getTel2() %>-<%=model.getTel3()==null?"":model.getTel3() %>
							</td>
				        </tr>
				        <%} %>
				        <tr>
							<th scope="row" >첨부파일</th>
							<td>
								<a href="/download/<%=model.getAtt_file() %>?name=<%=model.getOrg_file() %>&kind=" ><%=model.getOrg_file() %></a>
							</td>
				        </tr>
				        <tr>
							<th scope="row" >내용</th>
							<td>
								<%=model.getContent() %>
							</td>
				        </tr>
				        <% if(model.getBoard_kind().equals("qna")){ %>
				        <tr>
							<th scope="row" >답글</th>
							<td>
								<%=model.getRe_content()==null?"":model.getRe_content()  %>
							</td>
				        </tr>
				        <%} %>
				     </tbody>
				  </table>
				<!-- 버튼 시작 -->
				<div class="btn-all-align2">
				  <span class="btn-align"><input type="submit" value="수정" class="btn-bg-gray"  /></span>
				  <span class="btn-align"><input type="button" value="삭제" id="btDelete" class="btn-bg-gray"  /></span>
				  <span class="btn-align"><input type="button" value="목록" id="btList" class="btn-bg-gray"  /></span>
				</div>
				<!-- 버튼 끝 -->
				<div>
				<br></br>
				<br></br>
				<table class="view-normal" cellpadding="0" cellspacing="0" summary="게시판 관리" >
					<caption>게시판 관리</caption>
					    <col width="100px;" />  
					    <col/>  
				    <tbody>
						<tr>
							<th scope="row" >이전 글</th>
							<td>
								<%if(prvModel != null){ %>
									<%=prvModel.getTitle() %>
								<%}else{ %>
									이전 글이 없습니다.
								<%} %>
							</td>
				        </tr>
				        <tr>
				        	<th scope="row" >다음글 </th>
				        	<td>
				        		<%if(nextModel != null){ %>
									<%=nextModel.getTitle() %>
								<%}else{ %>
									다음 글이 없습니다.
								<%} %>
				        	</td>
				        </tr>
					</tbody>
				</table>
				</div>
				</form>
				<!-- 실제적인 리스트 끝 -->
			</div>
				
			<!--Contents End-->
		</div>
	</div>
</div>
<!--floater-->
<%@ include file="/admin/common/bottom.jsp" %>
<!--floater-->
</body>
</html>